package net.dreamlu.iot.mqtt.broker.http;

import net.dreamlu.iot.mqtt.core.server.http.api.MqttHttpRoute;
import net.dreamlu.iot.mqtt.core.server.http.api.result.Result;
import net.dreamlu.iot.mqtt.core.server.http.handler.MqttHttpRoutes;
import org.springframework.stereotype.Component;
import org.tio.http.common.HttpRequest;
import org.tio.http.common.HttpResponse;

/**
 * @author: chenlf
 * @date: 2023/9/5
 * @description: EndpointsHttpApi
 **/
@Component
public class EndpointsHttpApi implements MqttHttpRoute {
    @Override
    public String path() {
        return "/api/v1/endpoints";
    }

    @Override
    public HttpResponse invoke(HttpRequest request) {
        return Result.ok(request, MqttHttpRoutes.getRouts().keySet());
    }
}
